package com.caishi.lkx.user.userlog.model;

import cn.hutool.core.date.LocalDateTimeUtil;
import lombok.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 日志记录基础
 */
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class NormalLogRecords implements Serializable {

    @Id
    private String id;

    /**
     * 创建时间
     */
    private Long createdTime;

    /**
     * 所属机构
     */
    @Indexed
    private Long groupId;

    /**
     * 统计日期
     */
    @Indexed
    private Long date;

    /**
     * 记录天数
     */
    private Integer recordDays;


    private Count data = new Count();


    public LocalDate getDateT() {
        return LocalDateTimeUtil.of(this.date).toLocalDate();
    }

    public LocalDateTime getCreateTime() {
        return LocalDateTimeUtil.of(this.createdTime);
    }
}
